package utils

import (
	"github.com/go-ego/gpy"
	"strings"
)

// GetPinyin 获取汉字的全拼及简拼
func GetPinyin(chain string) (quanpin, jianpin string) {
	a := gpy.NewArgs()
	qpArr := gpy.Pinyin(chain, a)

	a.Style = gpy.FirstLetter
	jqArr := gpy.Pinyin(chain, a)
	for _, arr := range qpArr {
		quanpin += strings.Join(arr, "")
	}
	for _, arr := range jqArr {
		jianpin += strings.Join(arr, "")
	}
	return quanpin, jianpin
}
